import {uSelectDevMakeLog} from '@/api/dataOverview'
import {CCard} from '@/components/card'
import {CItemUpDown} from '@/components/item'
import {SplitLine} from '@/components/splitLine'
import {CnBoldSpan} from '@/components/text'
import {getUserId} from '@/libs/auth'
import '../css/trendsCard.less'
export const TrendsCard = defineComponent({
  setup(props, ctx) {
    const state = reactive<{logList: AlaramLog[]}>({
      logList: []
    })

    function getLogList() {
      const userId = getUserId()
      if (!userId) return
      uSelectDevMakeLog({userId})
        .then(res => {
          state.logList = res.data
        })
        .catch(err => {})
    }
    onMounted(() => {
      getLogList()
    })

    return () => (
      <CCard class='h-500 bg-white px-20' title='操作日志'>
        <div class='pt-16'>
          {state.logList.map(item => [
            <CItemUpDown title={item.operateUser} subTitle={item.createTime}>
              {item.devLogContent}
            </CItemUpDown>,
            <SplitLine class='w-full h-1 block p-0 mt-9'></SplitLine>
          ])}
        </div>
      </CCard>
    )
  }
})
